<template>
	<!-- 小纸条列表 -->
	<view class="paper-item flex items-center p-20 border-b border-gray-100" hover-class="bg-gray"
		@click="goChat(item.receiver)">
		<u-avatar class="item-img mr-20" :src="imageUrl(item.avatar)"></u-avatar>
		<view class="flex-1 flex flex-col">
			<view class="flex justify-between items-center">
				<text class="text-30 font-bold">{{item.name}}</text>
				<text class="text-28 text-gray-500">{{formatTimeText(item.createTime)}}</text>
			</view>
			<view class="flex justify-between items-center text-26 text-gray-500" style="position: relative">
				<text class="item-content ">{{item.content}}</text>
				<!-- <u-badge type="error" :count="item.count"></u-badge> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			item: {
				type: Object,
				default: () => ({})
			}
		},
		data() {
			return {

			}
		},
		computed: {},
		methods: {
			imageUrl(itemUrl) {
				return this.handleUrl(itemUrl);
			},
			formatTimeText(dateString) {
				return uni.$u.timeFrom(new Date(dateString), false)
			},
			goChat(uid) {
				uni.navigateTo({
					url: '/pages/platform/paper/chat?uid=' + uid
				});

			}
		}
	}
</script>

<style lang="scss" scoped>
	.paper-item {
		
		.item-img {
			width: 80rpx;
			height: 80rpx;
		}

		.item-content {
			margin-right: 100rpx;
			overflow: hidden;
			display: -webkit-box;
			-webkit-line-clamp: 1;
			-webkit-box-orient: vertical;
			word-break: break-all;
		}
	}
</style>